package com.kaifamiao.ioc.creation.test;

import com.kaifamiao.ioc.creation.Car;
import com.kaifamiao.ioc.creation.Sun;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.time.LocalDate;
import java.util.Calendar;

public class InstanceFactoryMethod {

    public static void main( String[] args ) {

        String configs = "classpath*:com/**/instance-factory-method.xml";
        // 创建 Spring 容器
        ApplicationContext container = new ClassPathXmlApplicationContext(configs);

        // 从 Spring 容器获得指定名称指定类型的 bean
        Car c = container.getBean( "car", Car.class );
        System.out.println( c );
        System.out.println( c.getBrand() );

        System.out.println( container.getBean("localDate") );

    }

}
